package com.marvels.common.constants;

import java.math.BigDecimal;

import org.apache.commons.lang.StringUtils;

import com.marvels.common.utils.CommonProperties;

/**
 * 展期常量枚举
 * @author 唐佩文
 *
 */
public enum ExtensionFunctionEnum {
	
	OneDayExtension("1",1,"0.1","1天展期"),
	ThreeDayExtension("2",3,"0.2","3天展期"),
	SevenDayExtension("3",7,"0.3","7天展期"),
	FQ_OneDayExtension("1",1,"0.07","1天展期"),
	FQ_ThreeDayExtension("2",3,"0.21","3天展期"),
	FQ_SevenDayExtension("3",7,"0.49","7天展期");
	private String type;
	private String value;//贷款金额百分比
	private String describe;
	private int day;
	ExtensionFunctionEnum(String type,Integer day,String value,String describe){
		this.describe=describe;
		this.type=type;
		this.value=value;
		this.day=day;
	}
	
	public static ExtensionFunctionEnum[] enums(){
		//分期模式时使用分期模式的比例
		ExtensionFunctionEnum[] result = new ExtensionFunctionEnum[3];
		if(StringUtils.equalsIgnoreCase("Y", CommonProperties.getNewRepaymentFlag())){
			result[0] = ExtensionFunctionEnum.FQ_OneDayExtension;
			result[1] = ExtensionFunctionEnum.FQ_ThreeDayExtension;
			result[2] = ExtensionFunctionEnum.FQ_SevenDayExtension;
		}else{
			result[0] = ExtensionFunctionEnum.OneDayExtension;
			result[1] = ExtensionFunctionEnum.ThreeDayExtension;
			result[2] = ExtensionFunctionEnum.SevenDayExtension;
		}
		return result;
	}
	
	public static BigDecimal[] vals(){
		//分期模式时使用分期模式的比例
		BigDecimal[] result = new BigDecimal[3];
		if(StringUtils.equalsIgnoreCase("Y", CommonProperties.getNewRepaymentFlag())){
			result[0] = new BigDecimal(ExtensionFunctionEnum.FQ_OneDayExtension.getValue());
			result[1] = new BigDecimal(ExtensionFunctionEnum.FQ_ThreeDayExtension.getValue());
			result[2] = new BigDecimal(ExtensionFunctionEnum.FQ_SevenDayExtension.getValue());
		}else{
			result[0] = new BigDecimal(ExtensionFunctionEnum.OneDayExtension.getValue());
			result[1] = new BigDecimal(ExtensionFunctionEnum.ThreeDayExtension.getValue());
			result[2] = new BigDecimal(ExtensionFunctionEnum.SevenDayExtension.getValue());
		}
		return result;
	}
	
	public String getType() {
		return type;
	}
	public void setType(String type) {
		this.type = type;
	}
	public String getValue() {
		return value;
	}
	public void setValue(String value) {
		this.value = value;
	}
	public String getDescribe() {
		return describe;
	}
	public void setDescribe(String describe) {
		this.describe = describe;
	}
	public int getDay() {
		return day;
	}
	public void setDay(int day) {
		this.day = day;
	}
	
	
	
}
